package org.example.exp2.exam10;

import java.util.ArrayList;
import java.util.List;

public class Group extends Component {
   private String name;
   private List childList = new ArrayList();

   public Group(String name){
      this.name = name;
   }

   public void share(String message, String video, String url) {
      for (Object o : childList) {
         ((Component)o).share(message, video, url);
      }
   }
   
   public void add(Component c) {
      childList.add(c);
   }
   
   public void remove(Component c) {
      childList.remove(c);
   }
   
   public Component getChild(int i) {
      return (Component) childList.get(i);
   }
}